<script setup>
import ComAffix from "@/components/ComAffix.vue";


</script>

<template>
  <div class="main">
    <el-affix :offset="0">
      <ComAffix></ComAffix>
    </el-affix>
    <div class="container w">
      <el-container>
        <el-aside width="200px">
          <el-menu :default-active="$route.path" router class="custom-sidebar">
            <el-menu-item index="/publish/">
              <template #title>
                <i class="el-icon-house mr-2"></i>
                <span>首页</span>
              </template>
            </el-menu-item>
            <el-menu-item index="/publish/post">
              <template #title>
                <i class="el-icon-edit mr-2"></i>
                <span>发布文章</span>
              </template>
            </el-menu-item>
            <el-menu-item index="/publish/manage">
              <template #title>
                <i class="el-icon-document mr-2"></i>
                <span>文章管理</span>
              </template>
            </el-menu-item>
            <el-menu-item index="/publish/statistics">
              <template #title>
                <i class="el-icon-pie-chart mr-2"></i>
                <span>数据管理</span>
              </template>
            </el-menu-item>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view />
        </el-main>
      </el-container>
    </div>
  </div>
</template>

<style scoped lang="scss">
.main {
  background-color: rgba(246, 243, 243, 0.62);
  min-height: 600px;
}

.w{
  width: 1020px;
  margin: 0 auto;
}
.custom-sidebar {
  // 基础样式
  border: none;
  background-color: transparent;

  // 菜单项样式
  :deep(.el-menu-item) {
    height: 48px;
    line-height: 48px;
    margin: 8px 0;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 14px;
    color: #4e5969;
    background-color: rgba(253, 253, 253, 0.9);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

    // 图标样式
    .el-icon {
      font-size: 16px;
      width: 20px;
      text-align: center;
    }

    // 悬停效果
    &:hover {
      background-color: rgb(211, 226, 236);
      transform: translateX(4px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }

    // 激活状态
    &.is-active {
      color: #475c69;
      background-color: #9dbed3;
      font-weight: 500;
      border-left: 4px solid #294d64;
      transform: translateX(0);
      box-shadow: 0 2px 8px rgba(22, 93, 255, 0.1);

      // 激活状态图标颜色
      .el-icon {
        color: #165DFF;
      }
    }
  }

  // 自定义滚动条（如果需要）
  ::-webkit-scrollbar {
    width: 4px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: #c0c4cc;
    border-radius: 4px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #909399;
  }
}

// 响应式设计
@media (max-width: 768px) {
  .custom-sidebar {
    :deep(.el-menu-item) {
      height: 40px;
      line-height: 40px;
      margin: 4px 0;
      padding: 0 12px;
    }
  }
}
</style>
